def is_prime(n): 
    if n <= 1: 
        return False 
    for i in range(2, int(n**0.5) + 1): 
        if n % i == 0: 
            return False 
    return True 
 
def find_closest_prime(n): 
    if n < 2: 
        return 2 
    prime = n 
    while True: 
        if is_prime(prime): 
            return prime 
        prime += 1 
 
def words_to_number(words): 
   
    words_to_numbers = { 
        'zero': '0', 'one': '1', 'two': '2', 'three': '3', 'four': '4', 
        'five': '5', 'six': '6', 'seven': '7', 'eight': '8', 'nine': '9' 
    } 
    number_str = '' 
    for word in words: 
        number_str += words_to_numbers.get(word, '') 
    return int(number_str) if number_str.isdigit() else None 
input_words = input("Введите три числа словами: ").split() 
if len(input_words) != 3: 
    print("Неверный ввод") 
else: 
    number = words_to_number(input_words) 
    if number is not None and 100 <= number <= 999: 
        print("Ближайшее простое число:", find_closest_prime(number)) 
    else: 
        print("Неверный ввод")
